<!--
 * @Author: Bobby
 * @Date: 2021-12-30 10:01:42
 * @LastEditTime: 2022-03-24 11:42:22
 * @LastEditors: Bobby
 * @Description:
 * @FilePath: \wms-v2\src\ve\elements\form\uiInput\uiInput.vue
 * CIMC-V2
-->
<template>
  <div class="w-full">
    <el-input
      :ref="moduleId"
      v-model="formDataItem[formDataKey]"
      clearable
      :disabled="disabled"
      placeholder="请输入"
      size="mini"
      @keyup.enter="nextModuleFocus"
    />
  </div>
</template>
<script>
  import { defineComponent } from 'vue'
  import { tableFormItemMixin } from '@ve/mixin'
  import { componentId } from '@/utils/unique'
  export default defineComponent({
    name: 'UiTableInput',
    components: {},
    mixins: [tableFormItemMixin],
    data() {
      return {
        moduleId: '',
      }
    },
    computed: {},
    watch: {},
    created() {
      // 生成组件ID
      this.moduleId = `uiTableInput_${componentId(6)}`
    },
    mounted() {
      // 添加组件实例至状态管理器存储
      if (!this.disabled)
        this.$store.dispatch('tableFormItem/setTableFormItemList', {
          id: this.moduleId,
          ref: this.$refs[this.moduleId],
        })
    },
    methods: {
      componentId,
    },
  })
</script>
<style scoped></style>
